<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>华夏跆拳道-登录</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.6 -->
    <link rel="stylesheet" href="{{ asset('admin/bootstrap/css/bootstrap.min.css') }}">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="{{ asset('admin/plugins/font-awesome/css/font-awesome.min.css') }}">
    <!-- Ionicons -->
    <link rel="stylesheet" href="{{ asset('admin/plugins/ionicons/css/ionicons.min.css') }}">
    <!-- Theme style -->
    <link rel="stylesheet" href="{{ asset('admin/dist/css/AdminLTE.min.css') }}">
    <!-- My Style -->
    <link rel="stylesheet" href="{{ asset('admin/dist/css/my-style.css') }}">
    <!-- AdminLTE Skins. Choose a skin from the css/skins
        folder instead of downloading all of them to reduce the load. -->
    <link rel="stylesheet" href="{{ asset('admin/dist/css/skins/_all-skins.min.css') }}">
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        华夏后台管理系统
    </div>
    <!-- /.login-logo -->
    <div class="login-box-body">
        <p class="login-box-msg">请输入您的账户名和密码</p>

        <form class="login-form" method="post">
            <div class="form-group has-feedback">
                <input type="text" class="form-control" name="username" placeholder="账号">
                <span class="glyphicon ion-person form-control-feedback" style="font-size: 18px;"></span>
            </div>
            <div class="form-group has-feedback">
                <input type="password" class="form-control" name="password" placeholder="密码">
                <span class="glyphicon glyphicon-lock form-control-feedback"></span>
            </div>

            {#<div class="form-group has-feedback">#}
                {#<input type="text" class="form-control v-code-input" placeholder="验证码">#}
                {#<img src="https://www.zuhaowan.com/Login/verifyGenerate.html" class="form-control-feedback v-code-img" alt="">#}
            {#</div>#}
            <div class="row">
            </div>

            <button type="button" class="btn btn-primary btn-block btn-flat">登录</button>
        </form>
    </div>
    <!-- /.login-box-body -->
</div>
<!-- /.login-box -->

<!-- jQuery 2.2.0 -->
<script src="{{ asset('admin/plugins/jQuery/jQuery-2.2.0.min.js') }}"></script>
<!-- Bootstrap 3.3.6 -->
<script src="{{ asset('admin/bootstrap/js/bootstrap.min.js') }}"></script>
<!-- AdminLTE App -->
<script src="{{ asset('admin/dist/js/app.min.js') }}"></script>
<!-- layer -->
<script src="{{ asset('admin/plugins/layer/layer.js') }}"></script>
<!--common-->
<script type="text/javascript" src="{{ asset('admin/dist/js/common.js') }}"></script>

<script>
    $(function() {
        $('.btn-block.btn-flat').on('click', function() {
            var login_param = $('.login-form').serializeObject();

            if ($.trim(login_param.username) == '' || $.trim(login_param.password) == '') {
                layer.msg('请输入完整');
                return;
            }

            if (login_param.password.length > 16 || login_param.password.length < 6) {
                layer.msg('密码长度应为6~18位');
                return;
            }

            $.post('{{ path('api_backend_login') }}', {username: login_param.username,password: login_param.password}, function(res) {
                if (res.errorCode == 0) {
                    layer.msg('登录成功');
                    location.href = '{{ path('backend_homepage') }}';
                } else {
                    layer.msg(res.message);
                }
            })
        })
    })
</script>
</body>
</html>
